package rsb21411ls.d1113;

import java.util.ArrayList;
import java.util.Iterator;

public class DemoArrarList02 {
    public static void main(String[] args) {
        ArrayList<String> arrayList =new ArrayList();
        //约束 体现在集合类 尖括号里对变量类型的限制
        arrayList.add("SDADADA");
        arrayList.add("DDDDD");
        arrayList.add("EEEEEDA");
        arrayList.add("RRRRRDA");
        arrayList.add("TTTTTTDA");
        //迭代器遍历
        Iterator<String>  it=arrayList.iterator();
        while (it.hasNext()) {
            System.out.println(it.next());
        }
        // System.out.println(it.next());报出异常 过多next会数组越界}
    }
}
